package com.gxa.autoparts.admin.service.impl;

import com.gxa.autoparts.admin.mapper.CouponMapper;
import com.gxa.autoparts.admin.service.CouponService;
import com.gxa.autoparts.core.pojo.Coupon;
import com.gxa.autoparts.core.pojo.CouponUseRecord;
import com.gxa.autoparts.core.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author R
 * @data 2022-01-10 16:13
 */
@Service
public class CouponServiceImpl extends BaseServiceImpl<Coupon> implements CouponService {

    @Autowired
    CouponMapper couponMapper;

    @Override
    public List<Map> couponUseRecord(Long id,Integer page,Integer size) {
        List<Map> maps = couponMapper.couponUseRecord(id,(page-1)*size,size);
        return maps;
    }

    @Override
    public Integer couponUseRecordCount(Long id) {
        Integer integer = couponMapper.couponUseRecordCount(id);
        return integer;
    }

    @Override
    public List<Map> couponUseRecordByLike(Long id, String name, Integer type, String userName, String phone, String useStartTime, String useEndTime, Integer page, Integer size) {
        List<Map> maps = couponMapper.couponUseRecordByLike(id, name, type, userName, phone, useStartTime, useEndTime, page, size);
        return maps;
    }

    @Override
    public List<Map> couponSelectAll(Integer page, Integer size) {
        List<Map> maps = couponMapper.couponSelectAll((page - 1) * size, size);
        return maps;
    }

    @Override
    public List<Map> couponSelectByLike(String name, Integer type, String startTime, String endTime, Integer page, Integer size) {
        List<Map> maps = couponMapper.couponSelectByLike(name, type, startTime, endTime, (page - 1) * size, size);
        return maps;
    }

    @Override
    public List<Integer> selectType() {
        List<Integer> list = couponMapper.selectType();
        return list;
    }

    @Override
    public List<Map> couponYes(Long id) {
        List<Map> maps = couponMapper.couponYes(id);
        return maps;
    }

    @Override
    public List<Map> couponNo(Long id) {
        List<Map> maps = couponMapper.couponNo(id);
        return maps;
    }
}
